package com.ivi.car.module.maintain.view;

import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageView;

import com.ivi.car.R;
import com.ivi.car.base.BaseActivity;
import com.ivi.car.module.maintain.view.adapter.MaintainCarAdapter;

import butterknife.BindView;

/**
 * Created by zhaolong.han on 2018/3/7.
 */

public class MaintainCarActivity extends BaseActivity implements View.OnClickListener {
  @BindView(R.id.left_btn)
  ImageView leftBtn;
  @BindView(R.id.tabLayout)
  TabLayout mTabLayout;
  @BindView(R.id.viewPager)
  ViewPager mViewPager;

  private int limit = 2;


  private String[] mTitles = new String[] {"养车计划", "待办订单"};

  @Override
  protected int getLayoutId() {
    return R.layout.activity_maintain;
  }

  @Override
  protected void initView() {
    leftBtn.setOnClickListener(this);

    MaintainCarAdapter viewPageAdapter =
        new MaintainCarAdapter(getSupportFragmentManager(), mTitles);
    mViewPager.setCurrentItem(0);
    mViewPager.setOffscreenPageLimit(limit);
    // 设置TabLayout的模式
    mTabLayout.setTabMode(TabLayout.MODE_FIXED);
    mViewPager.setAdapter(viewPageAdapter);
    mTabLayout.setupWithViewPager(mViewPager);
  }

  @Override
  protected void initData() {

  }

  @Override
  public void onClick(View view) {
    switch (view.getId()) {
      case R.id.left_btn:
        finish();
        break;
    }
  }
}
